import request from '@/config/axios'

// 提现 VO
export interface UserWithdrawVO {
  id: number // id
  userId: number // 用户id
  withdraw: number // 提现金额，单位：分
  status: boolean // 提现状态：0 待提现；1 提现成功；2 提现失败；3 提现取消；4 提现拒绝；
  withdrawUserName: string // 提现人姓名
  aliAccount: string // 提现到阿里账号
  screenshotUrl: string // 截图URL
  aliNo: string // 支付宝单号
  remark: string // 备注
}

// 提现 API
export const UserWithdrawApi = {
  // 查询提现分页
  getUserWithdrawPage: async (params: any) => {
    return await request.get({ url: `/member/user-withdraw/page`, params })
  },

  // 查询提现详情
  getUserWithdraw: async (id: number) => {
    return await request.get({ url: `/member/user-withdraw/get?id=` + id })
  },

  // 新增提现
  createUserWithdraw: async (data: UserWithdrawVO) => {
    return await request.post({ url: `/member/user-withdraw/create`, data })
  },

  // 修改提现
  updateUserWithdraw: async (data: UserWithdrawVO) => {
    return await request.post({ url: `/member/user-withdraw/update`, data })
  },

  // 删除提现
  deleteUserWithdraw: async (id: number) => {
    return await request.delete({ url: `/member/user-withdraw/delete?id=` + id })
  },

  // 导出提现 Excel
  exportUserWithdraw: async (params) => {
    return await request.download({ url: `/member/user-withdraw/export-excel`, params })
  }
}
